package top.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * @Desc
 * @Author houruiyang
 * @Date 2022/12/28
 **/
public class _094 {




    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> retList = new ArrayList<>();
        inorder(root, retList);
        return retList;
    }


    public void inorder(TreeNode root, List<Integer> res) {
        if (null == root) {
            return;
        }
        inorder(root.left, res);
        res.add(root.val);
        inorder(root.right, res);
    }
}


class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;

    TreeNode() {
    }

    TreeNode(int val) {
        this.val = val;
    }

    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}